package com.example.smartcity.ui.home;


import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import com.bumptech.glide.Glide;
import com.example.smartcity.R;
import com.google.android.material.appbar.MaterialToolbar;

public class News extends AppCompatActivity {

    private TextView newsTitle;
    private ImageView messagePhoto;
    private TextView messageContent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news);
        newsTitle = (TextView) findViewById(R.id.newsTitle);
        messagePhoto = (ImageView) findViewById(R.id.messagePhoto);
        messageContent = (TextView) findViewById(R.id.messageContent);initView();
    }
    public void setBack(View view){
        this.finish();
    }
    public void initView(){
        Intent intent = getIntent();
        if (intent!=null){
            String title =intent.getStringExtra("title");
            String imgUrl = intent.getStringExtra("imgUrl");
            String Content = intent.getStringExtra("Content");
            newsTitle.setText(title!= null ? title:null);
            Glide.with(News.this).load(imgUrl != null ? imgUrl : null).into(messagePhoto);
            messageContent.setText(Content != null ? Content : null);
        }
    }
}